////////////////////////////////////////////////////////////////////////////////
// Filename: color.vs
////////////////////////////////////////////////////////////////////////////////

#define MAX_NUM_LIGHTS 2

//////////////
// TYPEDEFS //
//////////////
struct VertexInputType
{
	float4 pos          : POSITION;         //posizione
    float3 norm         : NORMAL;           //normale
    float3 tan			: TANGENT;          //tangente
    float3 binorm       : BINORMAL;			//binormale
    float2 tex			: TEXCOORD;			//Coordinate texture
};

struct HullInputType
{
	float4 pos          : SV_POSITION;         //posizione
    float3 norm         : NORMAL;           //normale
    float3 tan			: TANGENT;          //tangente
    float3 binorm       : BINORMAL;			//binormale
    float2 tex			: TEXCOORD0;			//Coordinate texture
	float3 view			: POSITION0;
};

struct Light
{
    float4 pos;			// Pos
    float4 color;		// Color
    float4 ambient;		// ambient
    float3 attenuation; // Coeff distance point light dependant (k0+k1*d+k2*d*d)
};

cbuffer MatrixBuffer: register (b0)
{
    matrix worldMatrix;
    matrix viewMatrix;
    matrix projectionMatrix;
};

cbuffer CameraBuffer
{
	float3 cameraPosition;
};

////////////////////////////////////////////////////////////////////////////////
// Vertex Shader
////////////////////////////////////////////////////////////////////////////////
HullInputType TessVertexShader(VertexInputType input)
{
    HullInputType output;
    
	output.pos	= input.pos;
    output.norm = input.norm;
	output.tan	= input.tan;
	output.binorm = input.binorm;
    output.tex	= input.tex;

	float4 worldPosition = mul(input.pos, worldMatrix);

	output.view = (cameraPosition - worldPosition);
	/*output.view = float3(dot(output.view, input.tan),
							dot(output.view, input.binorm),
							dot(output.view, input.norm));				*/
    return output;
}